﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MainProGrid
{
    public partial class UrlFrm : Form
    {
        public UrlFrm()
        {
            InitializeComponent();
        }
        public string Value { get; set; }
        public List<string> Urls { get; set; }
        public List<string> Descriptions { get; set; }
        private void BtnOK_Click(object sender, EventArgs e)
        {
            Value = this.MyCombox.Text;
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void BtnCanel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.No;
            this.Close();
        }

        private void UrlFrm_Load(object sender, EventArgs e)
        {
            if (Urls != null && Descriptions != null) 
            {
                MyCombox.DataSource = Urls;
            }
            if (!string.IsNullOrEmpty(Value))
            {
                this.MyCombox.Text = Value;
            }
        }

        private void MyCombox_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = MyCombox.SelectedIndex;
            string mess=Descriptions[index];
            MyTxt.Text = mess;
        }
    }
}
